<?php
namespace llkphp\workerman\process\http\think\resetters;

use think\App;
use think\Model;
use llkphp\workerman\process\http\think\contract\ResetterInterface;
use llkphp\workerman\process\http\think\Sandbox;

class ResetModel implements ResetterInterface
{

    public function handle(App $app, Sandbox $sandbox)
    {
        if (class_exists(Model::class)) {
            Model::setInvoker(function (...$args) use ($sandbox) {
                return $sandbox->getSnapshot()->invoke(...$args);
            });
        }
    }
}
